<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let name = 'zs';
      function person() {
        console.log(this.name);
      }
      let person1 = {
        name: 'lisi',
      };
      Function.prototype.myCall = function (context) {
        if (typeof this != 'function') {
          throw new Error('error');
        }
        context = context || window;
        let args = [...arguments].slice(1);
        context.fn = this;
        const result = context.fn(...args);
        delete context.fn;
        return result;
      };
      person.myCall(person1, 1, 2, 3);
    </script>
  </body>
</html>
